package GREEDY_452;

import java.util.Arrays;
import java.util.Comparator;

public class Solution {
	public int findMinArrowShots(int[][] points) {
		if (points.length == 0) {
			return 0;
		}
		Arrays.sort(points, new Comparator<int[]>() {
			public int compare(int[] a, int b[]) {
				return a[1] - b[1];
			}
		});
		int count = 1;
		int x_end = points[0][1];
		for (int[] is : points) {
			int start = is[0];
			if (start > x_end) {
				x_end = is[1];
				count++;
			}
		}
		return count;

	}
}
